package org.dtrd.modules.content.articles.entity.bean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.dtrd.modules.content.articles.entity.po.DtrdExtEmsYwWords;
import org.dtrd.modules.faq.entity.po.DtrdExtEmsYwFaqs;
import org.springframework.cglib.beans.BeanCopier;

import java.util.Date;

/**
 * @Author: QR
 * @Date: 2021/9/2-16:37
 */
@Data
@ApiModel("知识问答内容")
@NoArgsConstructor
public class FaqInfo {

    /**
     * ID
     */
    @ApiModelProperty(name = "ID")
    private Integer dataId;

    /**
     * 常见问题
     */
    @ApiModelProperty(name = "常见问题")
    private String faqQuestion;

    /**
     * 问题答案
     */
    @ApiModelProperty(name = "问题答案")
    private String faqAnswer;

    /**
     * 所属分类Id
     */
    @ApiModelProperty(name = "所属分类Id")
    private Integer faqCategoryid;

    /**
     * 创建时间
     */
    @ApiModelProperty(name = "创建时间")
    private Date faqCreateTime;

    /**
     * 创建问题标签
     */
    @ApiModelProperty(name = "常见问题标签")
    private String faqTips;

    /**
     * 创建问题创始人
     */
    @ApiModelProperty(name = "常见问题创始人")
    private Integer faqCreater;

    /**
     * 最后修改人
     */
    @ApiModelProperty(name = "最后修改人")
    private String faqEditor;

    /**
     * 最后修改时间
     */
    @ApiModelProperty(name = "最后修改时间")
    private Date faqEditTime;

    /**
     * 常见问题URL
     */
    @ApiModelProperty(name = "常见问题URL")
    private String faqUrl;

    /**
     * 常见图片
     */
    @ApiModelProperty(name = "常见问题图片")
    private String faqThumb;

    /**
     * 浏览量
     */
    @ApiModelProperty(name = "浏览量")
    private Integer faqViews;

    public FaqInfo(DtrdExtEmsYwFaqs po) {
        BeanCopier beanCopier = BeanCopier.create(DtrdExtEmsYwFaqs.class, FaqInfo.class, false);
        beanCopier.copy(po, this, null);
    }

    public FaqInfo parseFromPo(DtrdExtEmsYwFaqs po) {
        dataId = po.getDataId();
        faqQuestion = po.getFaqQuestion();
        faqAnswer = po.getFaqAnswer();
        faqCategoryid = po.getFaqCategoryid();
        faqCreateTime = po.getFaqCreateTime();
        faqEditor = po.getFaqEditor();
        faqEditTime = po.getFaqEditTime();
        faqUrl = po.getFaqUrl();
        faqThumb = po.getFaqThumb();
        faqViews = po.getFaqViews();
        return this;
    }
}
